//
//  DownLoadTools.h
//  LearnImageCache
//
//  Created by isunn on 15/12/15.
//  Copyright (c) 2015年 Sunnsoft Co., Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSUInteger , DownLoadHandType) {
    DownLoadHandPause,
    DownLoadHandContinue,
    DownLoadHandCancel,
};

typedef NS_ENUM(NSUInteger , DownLoadStatus) {
    DownLoadStatusDownloading = 0,
    DownLoadStatusPaused,
    DownLoadStatusCanceled,
    DownLoadStatusFinished,
    DownLoadStatusNotRecord = 100 ,
};

extern NSString * const DownloadInfoNotification ;

//session完成后调用 complete handler
typedef void (^CompletionHandlerType)();

@interface DownLoadTools : NSObject<NSURLSessionDownloadDelegate>

// @{@"fileName":@"id"}
@property (nonatomic,strong) NSMutableDictionary * taskInfos;
@property (nonatomic) NSURLSession * downSession;

+(instancetype)shareTools;

//默认是放在doc下的某个文件夹下的
- (NSUInteger )downLoadWithUrlString:(NSString *)downloadPath andfileName:(NSString *)fileName;


- (void)downLoadTaskHand:(DownLoadHandType)handType withFileName:(NSString *)fileName;


- (void)bondDownloadedDataAndContinueDownloadWithFileName:(NSString *)fileName;


- (NSString *)customDownloadDirect;


- (void)logDownLoadToolsInfo;



/*
  下面这个是下载完成时候用的
 **/

- (void)addCompletionHandler:(CompletionHandlerType)handler forSession:(NSString *)identifier;


// issue: 1，真机测试后台的下载是不是能够唤醒。 2，需不需要bgMode 3，取消下载，删除对应的文件 4，查看文件对应的状态。

@end
